package cate.common.table.item.kitchenware.sheet;

import cate.common.table.ESheet;
import cate.common.table.item.kitchenware.row.KitchenwareAttrRow;
import cate.common.util.random.RWList;

import java.util.List;
import java.util.stream.Collectors;

public class KitchenwareAttrSheet extends ESheet<KitchenwareAttrRow> {
    @Override
    public String getSheetName() {
        return "厨具属性组";
    }

    public KitchenwareAttrRow randomGroupRow(int group, List<Integer> excludes) {
        RWList<KitchenwareAttrRow> rwList = new RWList<>();
        rwList.addAndSetup(getList().stream()
                .filter(e -> e.attrGroup == group && !excludes.contains(e.protoId))
                .collect(Collectors.toList()));
        return rwList.get();
    }


    public KitchenwareAttrRow getAttr(int group, int protoId) {
        return getList().stream().filter(e -> e.attrGroup == group && e.protoId == protoId).findAny().orElse(null);
    }
}
